<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document1</title>
    <link rel="stylesheet" href="./css/bootstrap.css">

    <link rel="stylesheet" href="./css/font-awesome.css">
</head>
<body>
  <div class="container">
      <div class="row">
          <div class="rol-md-8 justify-cont">
              <h3>用户列表</h3>
              <a href="./1.html" class="btn btn-success pull-right"><i class="fa fa-plus"></i>添加新用户</a>
          </div>
          <table class='table table-bordered table-striped'>

          <thead class="thead-dark">
            
              <tr>
                <th scope="col">序号</th>
                <th scope="col">id</th>
                <th scope="col">姓名</th>
                <th scope="col">邮箱</th>
                <th scope="col">电话号码</th>
                <th scope="col">操作</th>
              </tr>
            </thead>
            <tbody>
              <?php
              //引入数据库连接
              require_once "./conn.php";
              //引入结果记录集
              $result = mysqli_query($link,"select * from users");
              if (mysqli_num_rows($result)>0){
                $i=1;
                while ($row=mysqli_fetch_array($result)) {
                  
                
              ?>
              <tr>
                <th><?php echo $i;?></th>
                <td><?php echo $row['id'];?></td>
                <td><?php echo $row['name'];?></td>
                <td><?php echo $row['email'];?></td>
                <td><?php echo $row['moble'];?></td>
                <td><button type="button" class="btn btn-primary"><i class="fa fa-pencil fa-fw"></i>修改</button>
                <button type="button" class="btn btn-warning"><i class="fa fa-trash-o">删除</i></button>
              </td>
              </tr>
              <?php
              $i++;
              }
             }else{
               echo"<tr><td colspan='6' class='text-center'>无记录！</td></tr>";
             }
              ?>
            </tbody>
          </table>
      </div>
  </div>
</body>
</html>